<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>天天生鲜-后台登陆</title>
<link rel="stylesheet" href="css/login.css">
<link rel="short icon" href="images/logo.png" type="image/x-icon">
<script src="js/jquery-3.4.1.min.js"></script>

</head>
<body>
	<div id="login_top">
		<div id="welcome">
			欢迎使用天天生鲜后台管理系统
		</div>
		<div id="back">
			<a href="../index.html">返回首页</a>&nbsp;&nbsp; | &nbsp;&nbsp;
			<a href="#">帮助</a>
		</div>
	</div>
	<div id="login_center">
		<div id="login_area">
			<div id="login_form">
				<form action="" method="post" id="myform">
					<div id="login_tip">
						用户登录&nbsp;&nbsp;UserLogin
					</div>
					<div><input type="text" class="username" id="aname" placeholder="请输入账号..."></div>
					<div><input type="password" class="pwd" id="pwd" placeholder="请输入密码..."></div>
					<div id="btn_area">
						<input type="button"  onclick="Login()" id="sub_btn" value="登&nbsp;&nbsp;录">&nbsp;&nbsp;
					</div>
				</form>
			</div>
		</div>
	</div>
	<div id="login_bottom">
		<label style="color:#FFF"><a class="copy" href="#">嘟嘟嘟水果欢迎你的到来 </a>&copy; </label>
	</div>
</body>

<script type="text/javascript">
function Login() {

	var aname = $.trim($("#aname").val());
	if (aname == ""){
		$("#aname").addClass("navy_error");
		alert("账号不能为空");
		return;
	}
	console.log(aname);

	var pwd = $.trim($("#pwd").val());
	if (pwd == ""){
		$("#pwd").addClass("navy_error");
		alert("密码不能为空");
		return;
	}
	console.log(pwd);
	$.post("../admin/login", {aname:aname, pwd:pwd},function(data){
		data = parseInt($.trim(data));
		if (data == 1) {
			$("#myform")[0].reset();			
			//location.href="../admin/success";
			location.href="../back/page/index.html";
		} else {
			alert("账号或密码错误...");
		}
	},"text");
}

</script>
</html>